const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const homeRouter = require('./routes/home');
const uploadRouter = require('./routes/upload');
// 引入 连接mongodb代码
require('./model/connect')

const app = express();

app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

app.use('/static', express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname,'views'));
app.set('view engine', 'ejs')

app.use(uploadRouter);
app.use(homeRouter);
app.listen(3000, () => {
  console.log('程序启动了');
})